<?php
require_once '../global.php';/*必须的*/

function kiing_ajax_del(){
 
        $s = '11111111111';

        kc_ajax('ddddd',$s,'','',500,400);
} 

function king_def (){
global $king;
	

require_once '../class_ciji.php';/*必须的*/
require_once '../Snoopy.class.php';/*必须的*/
$spider  = new spider();

$keywords=kc_get('key','0');
$page=kc_get('pg','0');
$url = urlencode(k_dangdang_fc($keywords,'5'));

$spider->kuiurl = "http://wenwen.soso.com/z/QzoneSearch.e?sp=S".$url."&pg=".$page;
//$spider->kuiurl = "http://www.baidu.com";
$spider->getContent();

$spider->kuibody=array('<body','</body>');
$arraly=array('#<h4>(.*)</h4>(.*)<div class="bd">(.*)</div>(.*)<div class="ft">(.*)</div>#Us','yes');
$kuibody=$spider->gettitle($arraly[0],$arraly[1]);//标题
$arraly2=array('#<div class="mod_pagenav">(.*)</div><!--.result-->#Us','yes');
$kuify=$spider->gettitle($arraly2[0],$arraly2[1]);//标题



//print_r($kuify);

$sd[0]=$kuibody[1];
$sd[1]=$kuibody[3];
$sd[2]=$kuibody[5];
$king->load('user');

$user=$king->user->access();
if($user[userid]=='2'){
$bsk='7';
}elseif($user[userid]=='3'){
$bsk='8';
}elseif($user[userid]=='4'){
$bsk='9';
};



foreach($sd[0] as $key => $val){
		//$sd[0][$key]=str_replace('http://wenwen.soso.com/z/QzoneQuestion.e?sp=','javascript:;" onclick="$.kc_ajax({URL:\'/system/soso.php\',CMD:\'to\',\'tit\':\'',$sd[0][$key]);
		
		$sd[0][$key]=str_replace('http://wenwen.soso.com/z/QzoneQuestion.e?sp=','http://www.hw.com/portal/edt_index.php?action=edt&listid='.$bsk.'&ksid=',$sd[0][$key]);
		$sd[0][$key]=str_replace('<a class="c_tx"','<a target="_blank"',$sd[0][$key]);
		//$sd[0][$key]=str_replace('"><span class="c_tx">','\'})"><span class="c_tx">',$sd[0][$key]);		
		$content.=$sd[0][$key].'<br>'.$sd[1][$key].'<br>'.strip_tags($sd[2][$key])."<br>";
		
		
		
}


$content=str_replace('回答质量好','<b>回答质量好</b>',$content);

	$tmp=new KC_Template_class('template/so_default.htm','template/inside/search/caiji.htm');
	//$tmp->assign('type','search');
	$tmp->assign('content',$content);//这个还得获取
	$tmp->assign('title',$keywords);
	$tmp->assign('page','<div>'.str_replace('/z/QzoneSearch.e?sp=S','/system/soso.php?key=',$kuify[1][0]));


	echo $tmp->output();


}



function king_ajax_to(){
	global $king;
require_once '../class_ciji.php';/*必须的*/
require_once '../Snoopy.class.php';/*必须的*/
$spider  = new spider();

$s=kc_get('tit');

$spider->kuiurl = "http://wenwen.soso.com/z/QzoneQuestion.e?sp=".$s;
$spider->getContent();

$spider->kuibody=array('<body','</body>');
$arraly=array('#<h1 class="bor3"><span class="icon_done"></span>(.*)</h1>#Us','1');
$kuititle=$spider->gettitle($arraly[0],$arraly[1]);//标题
$arraly2=array('#<div class="mod_pagenav">(.*)</div><!--.result-->#Us','yes');
$kuify=$spider->gettitle($arraly2[0],$arraly2[1]);//标题


		$s.=$king->htmForm('标题','<input class="k_in w250" type="kew" name="kew" maxlength="100" value="'.$kuititle[0].'"/>');
		$s.=$king->htmForm('内容','<input class="k_in w250" type="kew" name="kew" maxlength="100" value="'.$kuititle[0].'"/>');
		
		//$but=kc_htm_a('提交','{URL:\'/system/soso.php\',CMD:\'tokey\'}');

//$s.= $king->lang->get('user/title/regstop');
		kc_ajax('请输入关键词',$s,'','',700,500);
	
}

function king_ajax_tokey(){
	global $king;
	
		$s=kc_get('tit','0').'<br>';
		$s.=$king->htmForm('关键词','<input class="k_in w150" type="kew" name="kew" maxlength="30" />');
		
		$but=kc_htm_a('提交','{URL:\'/system/soso.php\',CMD:\'tokey\'}');

//$s.= $king->lang->get('user/title/regstop');
		kc_ajax('请输入关键词',$s,$but,'',500,300);
	
}







?>